<?php
	$limit = '10000';
	$file = file_get_contents("http://browse.musicspace.mspace.fm/proxy/mspace.php?action=getfacetdata&server=http://helix.ecs.soton.ac.uk/mspace-php-server-musicspace/mspace/model/sdc_a43e5a8b74224d149fc0943fa127d2a6&format=json&constraint[f_SourceCollection][]&constraint[f_BirthDate][]&constraint[f_Composer][]&constraint[f_MusicalWork][]&constraint[f_Genre][]&view[f_Composer][]&offset=0&limit=$limit");
	
	$json = json_decode($file);
	
	$facet = $json->response->output->facets[0];
	$arr = array();
	for($i=0; $i<$limit; $i++)
	{
		$item = $json->response->output->facets[0]->items->{$i};
		$arr[] = $item;
	} 
	
	echo "var data = ".json_encode($arr).";\n";
?>